﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessTier.Facade.Interface;
using BusinessTier.DataContext;

namespace BusinessTier.Facade.Implementation
{
    public class NewsService : INewsService
    {
        public List<Domain.NewsItem> GetLastNewsItems(short count, string langCode)
        {
            using (var ctx = new SimplyData())
            {
                return ctx.NewsItems.Where(n => n.LangCode == langCode && n.IsApproved)
                                    .OrderByDescending(n => n.CreateDate)
                                    .Take(count).ToList();
            }
        }

        public void ApproveNewsItem(int id)
        {
            throw new NotImplementedException();
        }

        public void AddNewsItem(Domain.NewsItem news)
        {
            throw new NotImplementedException();
        }

        public void DeleteNewsItem(int id)
        {
            throw new NotImplementedException();
        }

        public void UpdateNewsItem(Domain.NewsItem news)
        {
            throw new NotImplementedException();
        }


        public List<Domain.SpecialOffer> GetLastSpecialOffers(short count, string langCode)
        {
            using (var ctx = new SimplyData())
            {
                return ctx.SpecialOffers.Where(n => n.LangCode == langCode && n.IsApproved)
                                    .OrderByDescending(n => n.CreateDate)
                                    .Take(count).ToList();
            }
        }

        public void ApproveSpecialOffer(int id)
        {
            throw new NotImplementedException();
        }

        public void AddSpecialOffer(Domain.SpecialOffer offer)
        {
            throw new NotImplementedException();
        }

        public void DeleteSpecialOffer(int id)
        {
            throw new NotImplementedException();
        }

        public void UpdateSpecialOffer(Domain.SpecialOffer offer)
        {
            throw new NotImplementedException();
        }
    }
}
